package com.company.pddpre09;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[][] solider = new int[N][M];
        for(int i = 0;i < N;i++){
            for(int j = 0;j < M;j++){
                solider[i][j] = sc.nextInt();
            }
        }

        int res = getBestNum(N,M,solider);
        System.out.println(res);


    }

    private static int getBestNum(int row,int col,int[][] solider){
        int maxSoilders = 0;
        for (int i = 0;i <  row;i++){
            for(int j = 0;j < col;j++){
                if(solider[i][j] == 1){
                    int tempSoilders = getNum(row,col,i,j,solider);
                    maxSoilders = Math.max(maxSoilders,tempSoilders);
                }
            }
        }
        return maxSoilders;
    }

    private static int getNum(int row, int col, int i, int j, int[][] solider) {
        int x_pos = 0,y_pos = 0;
        return 0;

    }

}
